package AS3
{
	public class Greeter
	{
		public static var validNames:Array = ["a","b,", "c"];
		public function Greeter()
		{
		}
		public static function sayHello(userName:String=""):String{
			var greeting:String;
			if(userName == ""){
				greeting = "Hello. Pls type your user name, and press Enter.";
			}
			else if(validName(userName)){
				greeting = "Hello " + userName + ".";
			}
			else{
				greeting = "Sorry, " + userName + ", you are not on the list.";
			}
			return greeting;
		}
		
		public static function validName(inputName:String=""):Boolean{
			if(validNames.indexOf(inputNames) > -1){
				return true;
			}
			else{
				return false;
			}
		}

	}
}